<!--{template common/header_ajax}-->
<!--{if $_GET['do']== 'getvotepost'}-->
<div class="dzzvote-container" id="dzzvote_post_$vote[voteid]">
	<ul class="nav nav-tabs nav-justified" role="tablist">
		<li <!--{if $vote[type]!=2}-->class="active"<!--{/if}-->>
			<a href="#dzzvote_post_text_$vote[voteid]" role="tab" data-toggle="tab"><i class="glyphicon glyphicon-file"></i> {lang sponsor_text_voting}</a>
		</li>
		<li <!--{if $vote[type]==2}-->class="active"<!--{/if}-->>
			<a href="#dzzvote_post_image_$vote[voteid]" role="tab" data-toggle="tab"><i class="glyphicon glyphicon-picture"></i> {lang sponsor_img_voting}</a>
		</li>
	</ul>
	<input type="hidden" id="dzzvoteid_$vote[voteid]" name="voteid" value="$vote[voteid]" />
	<input type="hidden" id="dzzvotetype_$vote[voteid]" name="vote[type]" value="$vote[type]" />
	<!-- Tab panes -->
	<div class="tab-content" style="padding:20px;">
		<div class="tab-pane <!--{if $vote[type]!=2}-->active<!--{/if}-->" id="dzzvote_post_text_$vote[voteid]">
			<div class="form-horizontal form-horizontal-left">
				<div class="form-group">
					<label class="control-label">{lang vote_title}</label>
					<div class="controls" style="padding-left:130px;float:none">
						<div class="col-xs-10" style="padding:0">
							<input type="text" class="form-control " style="width:100%" name="vote_subject_1" placeholder="{lang vote_title}" value="$vote['subject']" onblur="if(this.value==''){jQuery(this).addClass('input-error')}else{jQuery(this).removeClass('input-error');}">
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label "></label>
					<div class="controls" style="padding-left:130px;float:none"><span class="help-inline">{lang vote_choose}</span> </div>
				</div>
				<div class="dzzvote-post-item-container">
					<!--{if $vote[items][type_1]}-->
					<!--{loop $vote[items][type_1] $key $value}-->
					<div class="form-group dzzvote-post-text-item">
						<label class="control-label "><span class="badge">{eval echo $key+1;}</span></label>
						<div class="controls" style="padding-left:130px;float:none">
							<div class="col-xs-10" style="padding:0">
								<input type="text" class="form-control" style="width:100%" name="voteitem[{$value[itemid]}][content]" value="$value[content]">
								<input type="hidden" name="voteitemnew[{$value[itemid]}][aid]" value="$value[aid]">
							</div>
							<div class="col-xs-2">
								<a href="javascript:;" data-itemid="$value[itemid]" class="dzzvote-post-delitem ibtn dzz dzz-delete"></a>
							</div>
						</div>
					</div>
					<!--{/loop}-->
					<!--{else}-->
					<!--{eval for($i=1;$i<4;$i++){}-->
					<div class="form-group dzzvote-post-text-item">
						<label class="control-label "><span class="badge">$i</span></label>
						<div class="controls" style="padding-left:130px;float:none">
							<div class="col-xs-10" style="padding:0">
								<input type="text" class="form-control" style="width:100%" name="voteitemnew[content][]" value="">
								<input type="hidden" name="voteitemnew[aid][]" value="">
							</div>
							<div class="col-xs-2">
								<a href="javascript:;" data-itemid="0" class="dzzvote-post-delitem ibtn dzz dzz-delete"></a>
							</div>
						</div>
					</div>
					<!--{eval }}-->
					<!--{/if}-->
				</div>
				<div class="form-group">
					<label class="control-label "></label>
					<div class="controls" style="padding-left:130px;float:none">
						<a href="javascript:;" class="dzzvote-post-additem gray"><i class="ibtn dzz dzz-add" style="margin-top:-4px;margin-left:-10px;"></i> {lang add_option}</a>
					</div>
				</div>
			</div>
		</div>
		<div class="tab-pane <!--{if $vote[type]==2}-->active<!--{/if}-->" id="dzzvote_post_image_$vote[voteid]">
			<div id="dzzvote_post_image_container_$vote[voteid]" class="dzzvote-post-image-container" style="">
				<div class="form-group">
					<label class="control-label">{lang vote_title}</label>
					<div class="controls" style="padding-left:130px;float:none">
						<div class="col-xs-10" style="padding:0">
							<input type="text" class="form-control " style="width:100%;" name="vote_subject_2" placeholder="{lang vote_title}" value="$vote['subject']" onblur="if(this.value==''){jQuery(this).addClass('input-error')}else{jQuery(this).removeClass('input-error');}">
						</div>
						<div style="clear:both;"></div>
					</div>
				</div>
				<div class="dzzvote-post-image-header clearfix" style="padding:10px 10px;padding-left:50px;margin-bottom:15px;">
					<div class="pull-left" style="position:relative;overflow:hidden;">
						<button class="btn btn-simple" onclick="return false;">{lang vote_upload_pictures}</button>
						<input id="dzzvote_post_image_upload_$vote[voteid]" name="dzzvotefiles[]" tabindex="-1" style="position: absolute;outline:none;display:none; filter: alpha(opacity=0); PADDING-BOTTOM: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Arial; font-size: 180px;height:40px;width:100%;top: 0px; cursor: pointer; right: 0px; padding-top: 0px; opacity: 0;direction:ltr;background-image:none;" type="file" accept="image/jpeg,image/png,image/gif" multiple>
					</div>
					<!--<div class="pull-left ml20">
						<button class="btn btn-simple needindzz" onclick="dzzvote_uploadfrom_desktop();return false">{lang from_desktop_choose}</button>
					</div>-->
					<div style="clear:both"></div>
					<span class="help-inline" style="line-height:30px;padding-left:0px;">{lang upload_img_vote}</span>
				</div>
				<div class="dzzvote-post-item-container clearfix" style="padding-left:40px;">
					<!--{loop $vote[items][type_2] $value}-->
					<div class="dzzvote-post-image-item">
						<a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="$value['itemid']" class="dzzvote-post-delitem"><i class="ibtn glyphicon glyphicon-trash"></i></a>
						<div class="thumbnail">
							<div class="text-center">
								<a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" alt="$value['content']"></a>
							</div>
							<div class="caption text-center" style="">
								<input type="text" class="form-control input-image-title" name="voteitem[{$value[itemid]}][content]" value="$value[content]"/>
								<input type="hidden" name="voteitem[{$value[itemid]}][aid]" value="$value[aid]" />
							</div>
						</div>
					</div>
					<!--{/loop}-->
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label">{lang vote_choose1}</label>
			<div class="controls" style="padding-left:130px;float:none">
				<select id="dzzvote_maxselect_num_$vote[voteid]" name="vote[maxselectnum]" class="form-control col-xs-10" style="width:auto;">
					<!--{if $vote[voteid] && $vote['items']['type_'.$vote[type]]}-->
					<!--{loop $vote['items']['type_'.$vote[type]] $key $value}-->
					{eval $i=$key+1};
					<option value="$i" <!--{if $vote[maxselectnum]==$i}-->selected="selected"<!--{/if}-->>{lang most_can_choose} $i {lang item}
					</option>
					<!--{/loop}-->
					<!--{else}-->
					<option value="1">{lang most_can_choose} 1 {lang item}</option>
					<option value="2">{lang most_can_choose} 2 {lang item}</option>
					<option value="3">{lang most_can_choose} 3 {lang item}</option>
					<!--{/if}-->
				</select>
				<div style="clear:both"></div>
			</div>
		</div>
		<div class="form-group ">
			<label class="control-label">{lang deadline}</label>
			<select class="form-control col-xs-10" onchange="if(this.value){jQuery('#dzzvote_endtime_$vote[voteid]').datepicker('setDate',this.value)}else{jQuery('#dzzvote_endtime_$vote[voteid]').val('')}" style="width:120px;margin-left:10px">
				<option value="" selected="">{lang unlimited}</option>
				<option value="now" <!--{if $vote[endtime]}-->selected="selected"<!--{/if}-->>{lang custom}
				</option>
				<option value="7">{lang one_week}</option>
				<option value="1 month">{lang one_month}</option>
				<option value="6 month">{lang half_year}</option>
				<option value="12 month">{lang a_year}</option>
			</select>
			<input type="text" id="dzzvote_endtime_$vote[voteid]" name="vote[endtime]" class="form-control ml20 col-xs-10" style="width:120px;" value="$vote[endtime]" />
			<label class="control-label" style="clear:both"></label>
			<span class="help-inline" style="margin-left:10px;margin-top:7px;line-height:34px;">{lang input_self_defined_time}</span>
		</div>
		<div class="form-group">
			<label class="control-label">{lang vote_result}</label>
			<div class="controls col-xs-10" style="margin-left:10px">
				<div class="radio-custom radio-primary col-xs-4" style="margin-top:0px;margin-bottom:0px;">
					<input type="radio" name="vote[isvisible]" value="1" checked="checked" />
					<label class="radio radio-inline" style="margin-top:0px;padding-top:0px;"> {lang vote_visible}</label>
				</div>
				<div class="radio-custom radio-primary col-xs-4" style="margin-top:7px;margin-bottom:0px;">
					<input type="radio" name="vote[isvisible]" value="0" <!--{if isset($vote[invisible]) && $vote[invisible]<1}-->checked="checked"<!--{/if}--> />
					<label class="radio radio-inline" style="margin-top:0px;padding-top:0px;">{lang anyone_seen}</label>
				</div>
				
			</div><div style="clear:both;"></div>
		</div>

		<div class="form-group">
			<label class="control-label">{lang vote_user}</label>
			<div class="controls col-xs-10" style="margin-left:10px">
				<div class="radio-custom radio-primary col-xs-4" style="margin-top:0px;margin-bottom:0px;">
					<input type="radio" name="vote[showuser]" value="0" checked="checked">
					<label class="radio-inline" style="margin-top:0px;padding-top:0px;"> {lang no_show}</label>
				</div>
				<div class="radio-custom radio-primary col-xs-4" style="margin-top:7px;margin-bottom:0px;">
					<input type="radio" name="vote[showuser]" value="1" <!--{if $vote[showuser]}-->checked="checked"<!--{/if}-->>
					<label class="radio-inline" style="margin-top:0px;padding-top:0px;">{lang show}</label>
				</div>
			</div><div style="clear:both;"></div>
		</div>
	</div>
</div>
<script type="text/javascript" src="dzz/dzzvote/scripts/jquery.dzzvote.js?{VERHASH}"></script>
<script type="text/javascript" reload="1">
	jQuery(document).ready(function(e) {
		jQuery('#dzzvote_post_{$vote[voteid]}').find('a[href="#dzzvote_post_text_{$vote[voteid]}"]').on('shown.bs.tab', function(e) {
			jQuery('#dzzvotetype_{$vote[voteid]}').val(1);
		});
		jQuery('#dzzvote_post_{$vote[voteid]}').find('a[href="#dzzvote_post_image_{$vote[voteid]}"]').on('shown.bs.tab', function(e) {
			jQuery('#dzzvotetype_{$vote[voteid]}').val(2);
		});
		jcLoader().load({ type: 'css', ids: 'css_vote,css_datepicker', url: './dzz/dzzvote/images/vote.css?{VERHASH},./dzz/dzzvote/images/datepicker.css?{VERHASH}' });

		jcLoader().load({ type: "js", ids: 'js_ui_core,js_datepicker,js_dzzvote', url: "static/js/jquery.ui.core.js?{VERHASH},static/js/datepicker/jquery.ui.datepicker.min.js?{VERHASH}" }, function() {
			jQuery('#dzzvote_post_{$vote[voteid]}').dzzvote({ voteid: '$vote[voteid]' });
			jQuery('#dzzvote_post_image_upload_{$vote[voteid]}').show();
			jQuery('#dzzvote_endtime_{$vote[voteid]}').datepicker();
		});
		jQuery('#dzzvote_post_image_upload_{$vote[voteid]}').fileupload({
			url: '{DZZSCRIPT}?mod=dzzvote&op=ajax&do=imageUpload',
			dataType: 'json',
			autoUpload: true,
			paramName: 'dzzvotefiles[]',
			maxFileSize: 2000000, // 2 MB
			maxChunkSize: 2000000, //2M
			acceptFileTypes: new RegExp("\.(gif|jpe?g|png)$", 'i'),
			dropZone: jQuery('#dzzvote_post_image_container_{$vote[voteid]}'),
			pasteZone: jQuery('#dzzvote_post_image_container_{$vote[voteid]}'),
			sequentialUploads: true,
			add: function(e, data) {
				data.context = jQuery('<div class="dzzvote-post-image-item"></div>');
				jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-item-container').append(data.context);

				jQuery.each(data.files, function(index, file) {
					if(!file.name) file.name = 'clipboardData.png';
					var html = '';
					html += '  <a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="0" class="dzzvote-post-delitem" ><i class="ibtn glyphicon glyphicon-trash"></i></a>';
					html += ' <div class="thumbnail">';
					html += '		<img  src="dzz/images/default/upload_failure.png">';
					html += '    <div class="caption text-center">';
					html += '      <div class="progress-container" >';
					html += '  		  <div class="progress active" style="margin:0;" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">';
					html += '            	<div class="progress-bar progress-bar-success" style="width:0%;"></div>';
					html += '           </div>';
					html += '       </div>';
					html += '    </div>';
					html += ' </div>';
					jQuery(html).appendTo(data.context);
				});
				data.process().done(function() {
					data.submit();
				});

			},
			progress: function(e, data) {
				var index = 0; //data.index,
				var node = jQuery(data.context.children()[index]);
				var progress = parseInt(data.loaded / data.total * 100, 10);
				node.find('.progress-bar').css(
					'width',
					progress + '%'
				);
			},
			done: function(e, data) {
				jQuery.each(data.result.dzzvotefiles, function(index, file) {
					if(file.error) {
						data.context.find('.progress-container').replaceWith('<span class="text-danger">' + file.error + '</span>');
					} else {
						var html = '<input type="text" class="form-control input-image-title" name="voteitemnew[content][]" value="' + file.data.filename.replace(/\.(gif|jpe?g|png)$/i, '') + '" /><input type="hidden" name="voteitemnew[aid][]" value="' + file.data.aid + '" />';
						data.context.find('img').attr('src', file.data.img).end().find('.progress-container').replaceWith(html);
						dzzvote_maxselect_num();

					}
				});
			}
		});

	});

	function dzzvote_maxselect_num() {
		var val = parseInt(jQuery('#dzzvote_maxselect_num_{$vote[voteid]}').val());
		if(jQuery('#dzzvotetype_{$vote[voteid]}').val() > 1) {
			var sum = jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-image-item').length;
		} else {
			var sum = jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-text-item').length;
		}
		var option = '';
		for(var i = 1; i <= sum; i++) {
			if(i == val) {
				option += '<option value="' + i + '" checked="checked">{lang most_can_choose} ' + i + ' {lang item}</option>';
			} else {
				option += '<option value="' + i + '">{lang most_can_choose} ' + i + ' {lang item}</option>';
			}
		}
		jQuery('#dzzvote_maxselect_num_{$vote[voteid]}').html(option);
	}

	function dzzvote_uploadfrom_desktop() {
		if(!top._config) return;
		top.OpenFile('open', '{lang {lang open_file}}', { image: ['{lang type_image}(*.jpg,*.jpeg,*.png,*.gif)', ['IMAGE', 'JPG', 'JPEG', 'PNG', 'GIF'], 'selected']}, { multiple: true }, function(data) { //只打开本地盘
			var datas = [];
			if(data.params.multiple) {
				datas = data.icodata
			} else {
				datas = [data.icodata];
			}
			var html = '';
			for(var i in datas) {
				if(datas[i].type == 'image') {
					var img = DZZSCRIPT + '?mod=io&op=thumbnail&width=240&height=160&path=' + (datas[i].apath ? datas[i].apath : datas[i].dpath);
					html += '<div class="dzzvote-post-image-item">';
					html += '  <a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="0" class="dzzvote-post-delitem" ><i class="ibtn glyphicon glyphicon-trash"></i></a>';
					html += '  <div class="thumbnail">';
					html += '		<img  src="' + img + '">';
					html += '     <div class="caption text-center">';
					html += '  		  <input type="text" class="form-control input-image-title" name="voteitemnew[content][]" value="' + datas[i].name.replace(/\.(gif|jpe?g|png)$/i, '') + '">';
					html += '           <input type="hidden" name="voteitemnew[aid][]" value="' + datas[i].aid + '">';
					html += '     </div>';
					html += '   </div>';
					html += '</div>';
				}
			}
			if(html != '') {
				jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-item-container').append(html);
			}
		});
	}
</script>
<!--{elseif $_GET['do']=='getvote'}-->

<div id="dzzvote_$vote[voteid]" class="dzzvote dzzvote-text">
	<div class="dzzvote-header clearfix">
		<div class="pull-left">
			<div class="dzzvote-header-plate"> <span class="plate-title">{lang number_participants}</span> <em class="voter-num ">$votesum</em> </div>
		</div>
		<div class="dzzvote-header-body">
			<h4 class="dzzvote-subject">$vote[subject]</h4>
			<div class="dzzvote-info">$endtime | {lang most_can_choose1} $vote['maxselectnum'] {lang item}</div>
		</div>
	</div>
	<!--{if $status>0}-->
	<div class="dzzvote-body" id="vote_text_$vote[voteid]">
		<!--{if $vote[type]==1}-->
		<!--{loop $vote['items']['type_1'] $value}-->
		<div class="form-group clearfix">
			<div class="col-sm-8 checkbox"> $value[content] </div>
			<div class="col-sm-4">
				<div class="progress">
					<div class="progress-bar  progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
				</div>
			</div>
		</div>
		<!--{/loop}-->
		<!--{else}-->
		<div class="dzzvote-image-body clearfix">
			<!--{loop $vote['items']['type_2'] $value}-->
			<div class="dzzvote-image-item noactive hasprogress">
				<div class="thumbnail">
					<div class="text-center" style="height:100px;">
							<a style="display:inline-block" href="$value[url]" target="_blank"><table width="100%" height="100%"><tr><td align="center" valign="middle"><img src="$value[img]" title="$value['content']"></td></tr></table></a>
						</div>
					<div class="caption text-center" style="">
						<div class="progress">
							<div class="progress-bar  progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
						</div>
						<div class="content">$value['content']</div>
					</div>
				</div>
			</div>
			<!--{/loop}-->
		</div>
		<!--{/if}-->

	</div>
	<!--{if $status==1}-->
	<div class="dzzvote-footer ">
		<span class="success">{lang vote_thinks}</span>

	</div>
	<!--{/if}-->

	<!--{else}-->
	<form id="voteform_$vote[voteid]" name="voteform" action="{DZZSCRIPT}?mod=dzzvote&op=ajax&do=itemvote" method="post" style="margin:0" onsubmit="validate_{$vote[voteid]}(this);return false">
		<input type="hidden" name="votesubmit" value="true" />
		<input type="hidden" name="handlekey" value="dzzvote_{$vote[voteid]}" />
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<div class="dzzvote-body" id="vote_text_$vote[voteid]">
			<!--{if $vote[type]==1}-->
			<!--{loop $vote['items']['type_1'] $value}-->
			<div class="form-group clearfix">
				<!--{if $vote['isvisible']>0}-->
				<div class="checkbox">
					<label>
          <input type="checkbox" id="item_$value[itemid]"  name="vote[]" value="$value[itemid]" >
          $value[content] </label>
				</div>
				<!--{else}-->
				<div class="col-sm-8 checkbox">
					<label>
          <input type="checkbox" id="item_$value[itemid]"  name="vote[]" value="$value[itemid]" >
          $value[content] </label>
				</div>
				<div class="col-sm-4">
					<div class="progress">
						<div class="progress-bar  progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
					</div>
				</div>
				<!--{/if}-->
			</div>

			<!--{/loop}-->
			<!--{else}-->
			<div class="dzzvote-image-body clearfix">
				<!--{loop $vote['items']['type_2'] $value}-->

				<!--{if $vote['isvisible']>0}-->
				<div id="item_$value[itemid]" data-itemid="$value[itemid]" class="dzzvote-image-item ">
					<div style="position:absolute;right:15px;top:15px;"><i class="ibtn glyphicon glyphicon-ok"></i></div>
					<div class="thumbnail">
						<div class="text-center" style="height:100px;">
							<a style="display:inline-block" href="$value[url]" target="_blank"><table width="100%" height="100%"><tr><td align="center" valign="middle"><img src="$value[img]" title="$value['content']"></td></tr></table></a>
						</div>
						<div class="caption text-center" style="">
							<div class="content">$value['content']</div>
						</div>
					</div>
				</div>
				<!--{else}-->
				<div id="item_$value[itemid]" data-itemid="$value[itemid]" class="dzzvote-image-item hasprogress">
					<div style="position:absolute;right:15px;top:15px;"><i class="ibtn glyphicon glyphicon-ok"></i></div>
					<div class="thumbnail">
						<div class="text-center" style="height:100px;">
							<a style="display:inline-block" href="$value[url]" target="_blank"><table width="100%" height="100%"><tr><td align="center" valign="middle"><img src="$value[img]" title="$value['content']"></td></tr></table></a>
						</div>
						<div class="caption text-center" style="">
							<div class="progress">
								<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
							</div>
							<div class="content">$value['content']</div>
						</div>
					</div>
				</div>
				<!--{/if}-->
				<!--{/loop}-->
			</div>
			<!--{/if}-->
		</div>

		<div class="dzzvote-footer">
			<button id="votesubmit_btn_$vote[voteid]" class="btn btn-primary ml20" style="padding:6px 25px;" data-loading-text="{lang in_vote}">{lang vote}</button>
			<small id="error_msg" style="color:red;padding:0 10px;line-height:30px;"></small> </div>
	</form>
	<!--{/if}-->
	<!--{if $vote[showuser]}-->
	<div id="voteuser_{$vote[voteid]}" class="dzzvote-user clearfix">
		<script type="text/javascript" reload="1">
			jQuery('#voteuser_{$vote[voteid]}').load('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteuser&voteid=$vote[voteid]&page=1');
		</script>
	</div>
	<!--{/if}-->
</div>

<script type="text/javascript">
	var maxselectnum_{$vote[voteid]} = parseInt('$vote[maxselectnum]');
	var checkarr_{$vote[voteid]} = [];
	jcLoader().load({ type: 'css', url: './dzz/dzzvote/images/vote.css?{VERHASH},static/icheck/skins/minimal/blue.css?{VERHASH}' });
	jcLoader().load({ type: 'js', url: 'static/icheck/icheck.min.js?{VERHASH}' }, function() {
		jQuery('#dzzvote_{$vote[voteid]} input').iCheck({
			checkboxClass: 'icheckbox_minimal-blue',
			radioClass: 'iradio_minimal-blue',
		});

		jQuery('#dzzvote_{$vote[voteid]} input').on('ifChecked', function(e) {
			if(checkarr_{$vote[voteid]}.length >= maxselectnum_{$vote[voteid]}) {
				jQuery('#'+checkarr_{$vote[voteid]}.pop()).iCheck('uncheck');
			}
			checkarr_{$vote[voteid]}.push(this.id);
		});
		jQuery('#dzzvote_{$vote[voteid]} input').on('ifUnchecked', function(e) {
			var i = jQuery.inArray(this.id, checkarr_{$vote[voteid]});
			if(i > -1) checkarr_{$vote[voteid]}.splice(i, 1);
		});
		jQuery('#dzzvote_{$vote[voteid]} .dzzvote-image-item:not(.noactive)').on('click', function() {

			if(jQuery(this).hasClass('active')) {
				var i = jQuery.inArray(this.id, checkarr_{$vote[voteid]});
				if(i > -1) checkarr_{$vote[voteid]}.splice(i, 1);
				jQuery(this).removeClass('active');
				jQuery(this).find('input[type=hidden]').remove();

			} else {
				if(checkarr_{$vote[voteid]}.length >= maxselectnum_{$vote[voteid]}) {
					var oldid = checkarr_{$vote[voteid]}.pop();
					var i = jQuery.inArray(oldid, checkarr_{$vote[voteid]});
					if(i > -1) checkarr_{$vote[voteid]}.splice(i, 1);
					jQuery('#' + oldid).removeClass('active');
					jQuery('#' + oldid).find('input[type=hidden]').remove();
				}
				checkarr_{$vote[voteid]}.push(this.id);
				jQuery(this).addClass('active');
				jQuery('<input type="hidden" name="vote[]" value="' + jQuery(this).data('itemid') + '" />').appendTo(this);
			}

		});

	});

	function validate_$vote[voteid](form) {
		if(checkarr_{$vote[voteid]}.length < 1) {
			showmessage('{lang please_select_vote_project}', 'danger', 3000, 1);
			return false;
		}
		jQuery('#votesubmit_btn_$vote[voteid]').button('loading');
		ajaxpost(form.id, 'votesubmit_btn_$vote[voteid]', 'votesubmit_btn_$vote[voteid]');
	}

	function succeedhandle_dzzvote_{$vote[voteid]}(url, message, values) {
		ajaxget('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteresult&voteid=$vote[voteid]', 'dzzvote_$vote[voteid]', 'dzzvote_$vote[voteid]');
	};
</script>

<!--{elseif $_GET['do']=='getvoteresult'}-->
<div class="dzzvote-header clearfix">
	<div class="pull-left">
		<div class="dzzvote-header-plate"> <span class="plate-title">{lang number_participants}</span> <em id="voter_num">$votesum</em> </div>
	</div>
	<div class="dzzvote-header-body">
		<h4 class="dzzvote-subject">$vote[subject]</h4>
		<div class="dzzvote-info">$endtime | {lang most_can_choose1} $vote['maxselectnum'] {lang item}</div>
	</div>
</div>
<div class="dzzvote-body" id="vote_text_$vote[voteid]">
	<!--{if $vote[type]==1}-->
	<!--{loop $vote['items']['type_1'] $value}-->
	<div class="form-group clearfix">
		<div class="col-sm-8 checkbox"> $value[content] </div>
		<div class="col-sm-4">
			<div class="progress">
				<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
			</div>
		</div>
	</div>
	<!--{/loop}-->
	<!--{else}-->
	<div class="dzzvote-image-body clearfix">
		<!--{loop $vote['items']['type_2'] $value}-->
		<div class="dzzvote-image-item hasprogress">
			<div class="thumbnail">
				<div class="text-center" style="height:100px;">
							<a style="display:inline-block" href="$value[url]" target="_blank"><table width="100%" height="100%"><tr><td align="center" valign="middle"><img src="$value[img]" title="$value['content']"></td></tr></table></a>
						</div>
				<div class="caption text-center" style="">
					<div class="progress">
						<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
					</div>
					<div class="content">$value['content']</div>
				</div>
			</div>
		</div>
		<!--{/loop}-->
	</div>
	<!--{/if}-->
</div>
<div class="dzzvote-footer"><span class="success">{lang vote_thinks}</span></div>
<!--{if $vote[showuser]}-->
<div id="voteuser_{$vote[voteid]}" class="dzzvote-user clearfix">
	<script type="text/javascript" reload="1">
		jQuery('#voteuser_{$vote[voteid]}').load('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteuser&voteid=$vote[voteid]&page=1');
	</script>
</div>
<!--{/if}-->

<!--{/if}-->
<!--{template common/footer_ajax}-->